package com.njitt.demo.service.impl;

import com.njitt.demo.mapper.StudentMapper;
import com.njitt.demo.pojo.Student;
import com.njitt.demo.service.StudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Resource
    private StudentMapper studentMapper;

    @Override
    public List<Student> queryStudentList() {
        return studentMapper.queryStudentList();
    }

    @Override
    public Student Sel(Student student) {
        return studentMapper.Sel(student);
    }

    @Override
    public String Add(Student student) {
        int a = studentMapper.Add(student);
        if(a==1){
            return "添加成功";
        }else{
            return "添加失败";
        }

    }

    @Override
    public String Update(Student student) {
        int a = studentMapper.Update(student);
        if (a == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }

    @Override
    public String Delete(Student student) {
        int a = studentMapper.Delete(student);
        if (a == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }
}
